<template>
  <!-- 页面内容不通过BlockList组件 -->
  <div class="block-list">
    <div class="group-block noneditable">
      <component
        v-for="item of $store.state.xmleditor.storeBlockList"
        :is="getComponentName(item)"
        :key="item.blockId"
        :blockData="item"
        :container="container"
      />
    </div>
  </div>
</template>

<script>
import EditorTable from './Table.vue'
import EditorFigure from './Figure.vue'
import EditorFormula from './Formula.vue'
import Example from './Example.vue'
import NakedFigure from './NakedFigure.vue'
import Endline from './Endline.vue'
import ItemList from './ItemList.vue'
import BlockGroup from './BlockGroup.vue'
import Paragraph from './Paragraph.vue'
import ItemNote from './ItemNote.vue'
import TermBlock from './TermBlock.vue'
import { getComponentName } from '@/utils/helpers'

export default {
  name: 'BlockList',
  components: {
    EditorTable,
    EditorFigure,
    EditorFormula,
    Example,
    NakedFigure,
    Endline,
    Paragraph,
    BlockGroup,
    TermBlock,
    ItemList,
    ItemNote
  },
  props: {
    container: {
      type: String,
      default: ''
    }
  },
  // 没有实质意义,但后代组件需要传递该值
  provide: {
    pageType: ''
  },
  methods: {
    getComponentName
  }
}
</script>
